﻿using System;
using System.Windows.Data;
using TopBuilds.Restaurant.Data;

namespace TopBuilds.Restaurant.ViewModel
{
    public class ProductValueConverter : IValueConverter
    {
        object IValueConverter.Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            Product p = ProductObject.GetProduct(Convert.ToInt32(value.ToString()));

            if (p != null)
            {
                return p.Name;
            }

            return null;
        }

        object IValueConverter.ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}
